// 参考文章  https://juejin.cn/post/7402696141495779363?searchId=20240915210327E0FD31B956545FCCFF41
import globals from 'globals'
import pluginJs from '@eslint/js'
import tseslint from 'typescript-eslint'
import pluginVue from 'eslint-plugin-vue'
import parserVue from 'vue-eslint-parser'

export default [
    {
        languageOptions: {
            globals: {
                ...globals.browser,
                FormFields: true,
                FormInstance: true
            },
            ecmaVersion: 2020,
            parser: parserVue,
            parserOptions: {
                parser: tseslint.parser,
                ecmaFeatures: {
                    jsx: true
                }
            }
        }
    },
    pluginJs.configs.recommended,
    ...tseslint.configs.recommended,
    ...pluginVue.configs['flat/essential'],
    {
        rules: {
            'no-console': 2,
            'no-var': 2,
            'camelcase': 2,
            'no-inline-comments': 2,
            '@typescript-eslint/no-explicit-any': 0,
            '@typescript-eslint/ban-ts-comment': 0,
            '@typescript-eslint/no-empty-object-type': 0,
            'vue/multi-word-component-names': 0,
            '@typescript-eslint/no-unused-expressions': 0
        },
        files: ['**/*.ts', '**/*.tsx', '**/*.vue', '**/*.js']
    },
    {
        ignores: ['dist/*', 'node_modules/*', 'public/*', '**/*.svg']
    }
]
